package gov.gfbzb.advice.controller;

import gov.gfbzb.advice.service.IAdviceService;
import gov.gfbzb.advice.service.IStatisticsService;
import gov.gfbzb.advice.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Log4j2
@RestController
@Tag(name = "统计控制器")
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    private IStatisticsService statisticsService;

    @Operation(summary = "关键词")
    @GetMapping("/getKeyWord")
    public Result getKeyWord() {
        return Result.success(statisticsService.getKeyWord());
    }

    @Operation(summary = "各区县咨询————总问题量——包括待审核、已审核、已驳回")
    @GetMapping("/getCountyQuestionAllCount")
    public Result getCountyQuestionAllCount(){
        return Result.success(statisticsService.getCountyQuestionCount(null));
    }

    @Operation(summary = "各区县咨询————待审核问题量")
    @GetMapping("/getCountyNoPassQuestionCount")
    public Result getCountyNoPassQuestionCount(){
        return Result.success(statisticsService.getCountyQuestionCount(false));
    }

    @Operation(summary = "各区县咨询————已审核问题量")
    @GetMapping("/getCountyPassQuestionCount")
    public Result getCountyPassQuestionCount(){
        return Result.success(statisticsService.getCountyQuestionCount(true));
    }

    @Operation(summary = "总咨询————总问题量————包括待审核、已审核、已驳回")
    @GetMapping("/getAllQuestionAllCount")
    public Result getAllQuestionAllCount(){
        return Result.success(statisticsService.getAllQuestionCount(null));
    }

    @Operation(summary = "总咨询————总待审核、已驳回问题量")
    @GetMapping("/getAllQuestionNoPassCount")
    public Result getAllQuestionNoPassCount(){
        return Result.success(statisticsService.getAllQuestionCount(false));
    }

    @Operation(summary = "总咨询————总已审核问题量")
    @GetMapping("/getAllQuestionPassCount")
    public Result getAllQuestionPassCount(){
        return Result.success(statisticsService.getAllQuestionCount(false));
    }

    @Operation(summary = "日总问题量")
    @GetMapping("/getDayQuestionAllCount")
    public Result getDayQuestionAllCount(){
        return Result.success(statisticsService.getDayQuestionAllCount());
    }

    @Operation(summary = "周总问题量")
    @GetMapping("/getWeekQuestionAllCount")
    public Result getWeekQuestionAllCount(){
        return Result.success(statisticsService.getWeekQuestionAllCount());
    }

    @Operation(summary = "月总问题量")
    @GetMapping("/getMonthQuestionAllCount")
    public Result getMonthQuestionAllCount(){
        return Result.success(statisticsService.getMonthQuestionAllCount());
    }

}
